package com.jfinal.bloglist.controller;

import com.jfinal.bloglist.model.Blog;
import com.jfinal.core.Controller;

import java.util.List;

/**
 * Title:
 * Description:
 *
 * @version 2.0
 * @author: Yung Fu(FUYUNGCN AT GMAIL DOT com)
 * @since: 14-10-11 下午10:57
 */
public class BlogController extends Controller {

    public void index() {

        Blog blog = Blog.dao.findById("1");
        setAttr("blog", blog);
        renderFreeMarker("/WEB-INF/blog/index.html");
    }

    public void queryBlogList() {
        List<Blog> blogList = Blog.dao.find("select b.*,t.* from blog b left join blog_type t on b.t_id = t.id order by b.create_time desc");
        setAttr("blogList", blogList);
        renderFreeMarker("/WEB-INF/blog/index.html");
    }

    public void updateBlog() {
        Blog.dao.update();
    }
}
